﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ModuleCustomer.ViewModel;
using ServerConnection.ShopServiceReference;

namespace ModuleCustomer.View
{
    /// <summary>
    /// Interaction logic for CustomerViewList.xaml
    /// </summary>
    public partial class CustomerViewList : UserControl, ICustomerViewList
    {
        public CustomerViewList()
        {
            InitializeComponent();
            ViewModel = new CustomerViewModel();
            DataContext = ViewModel;

        }

        public void Refresh(Dictionary<string, object> filter = null)
        {
            
            if (filter == null)
            {
                filter = new Dictionary<string, object>();
                filter.Add("place", (int)ViewModel.OnSelectedPlace);
            }
            ViewModel.Load(filter);
            DataContext = ViewModel;
        }

        public User Selected ()
        {
            return ViewModel.OnSelected;
        }

        public ViewModel.ICustomerViewModel ViewModel
        {
            get;
            set;
        }
    }
}
